﻿namespace RabbitMQDemo.Common
{
    public static class Utils
    {
        public static int GetFirstValue(string[] args, int defaultValue = 0)
        {
            if (args == null || args.Length == 0)
                return defaultValue;

            if (!int.TryParse(args[0], out int value))
                return defaultValue;

            return value;
        }

        public static string GetFirstString(string[] args, string defaultValue = "")
        {
            if (args == null || args.Length == 0)
                return defaultValue;

            return args[0];
        }
    }
}
